xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache
authorOlaf Hering <olaf@aepfle.de>
Fri, 10 Jun 2011 08:47:10 +0000 (10:47 +0200)
committerOlaf Hering <olaf@aepfle.de>
Fri, 10 Jun 2011 08:47:10 +0000 (10:47 +0200)
Move xc_mem_paging_flush_ioemu_cache() into xenpaging and massage it a bit to
use the required members from xenpaging_t.
Also update type of rc to match xs_write() return value.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/xenpaging/xc.c
tools/xenpaging/xc.h
tools/xenpaging/xenpaging.c

index 26b8d0fd729780d9f286783eb08c0b110c577fbb..211977504d4dffcac3827bca9854264311da5cdc 100644 (file)
 
 
 
-int xc_mem_paging_flush_ioemu_cache(domid_t domain_id)
-{
-    struct xs_handle *xsh = NULL;
-    char path[80];
-    int rc;
-
-    sprintf(path, "/local/domain/0/device-model/%u/command", domain_id);
-
-    xsh = xs_daemon_open();
-    if ( xsh == NULL )
-        return -EIO;
-
-    rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
-
-    xs_daemon_close(xsh);
-
-    return rc ? 0 : -1;
-}
 
 int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms)
 {
index f0e714cfe1228e16f7052c93a7941d5f1baaff71..665bcf5c69c6a5f46b63cc540cd9c1073b282f01 100644 (file)
@@ -37,7 +37,6 @@
 
 
 
-int xc_mem_paging_flush_ioemu_cache(domid_t domain_id);
 int xc_wait_for_event_or_timeout(xc_interface *xch, xc_evtchn *xce, unsigned long ms);
 
 
index 09db0b449997821d737c2be38066596753ba5de8..405113a492f2718827a6a2e0ace8baef3e4e7371 100644 (file)
@@ -48,6 +48,20 @@ static void close_handler(int sig)
         unlink(filename);
 }
 
+static int xenpaging_mem_paging_flush_ioemu_cache(xenpaging_t *paging)
+{
+    struct xs_handle *xsh = paging->xs_handle;
+    domid_t domain_id = paging->mem_event.domain_id;
+    char path[80];
+    bool rc;
+
+    sprintf(path, "/local/domain/0/device-model/%u/command", domain_id);
+
+    rc = xs_write(xsh, XBT_NULL, path, "flush-cache", strlen("flush-cache")); 
+
+    return rc == true ? 0 : -1;
+}
+
 static void *init_page(void)
 {
     void *buffer;
@@ -484,7 +498,7 @@ static int evict_victim(xenpaging_t *paging,
         else
         {
             if ( j++ % 1000 == 0 )
-                if ( xc_mem_paging_flush_ioemu_cache(paging->mem_event.domain_id) )
+                if ( xenpaging_mem_paging_flush_ioemu_cache(paging) )
                     ERROR("Error flushing ioemu cache");
         }
     }